﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UlsStudio.Engine;

namespace UlsStudio.DesktopApp
{
    public class ColumnSettings
    {
        public ColumnSettings()
        {
            this.ColumnWidths = new Dictionary<string, int>();
        }
        public Dictionary<string, int> ColumnWidths { get; set; }

        public int GetWidth(string fieldName, int defaultValue)
        {
            if (this.ColumnWidths.ContainsKey(fieldName))
            {
                return this.ColumnWidths[fieldName];
            }
            else
                return defaultValue;
        }

        public static ColumnSettings DefaultSettings
        {
            get
            {
                ColumnSettings s = new ColumnSettings();
                s.ColumnWidths.Add(Constants.FIELD_NAME_CATEGORY, 100);
                s.ColumnWidths.Add(Constants.FIELD_NAME_CORRELATION, 210);
                s.ColumnWidths.Add(Constants.FIELD_NAME_EVENTID, 55);
                s.ColumnWidths.Add(Constants.FIELD_NAME_ID, 50);
                s.ColumnWidths.Add(Constants.FIELD_NAME_LEVEL, 65);
                s.ColumnWidths.Add(Constants.FIELD_NAME_MSG, 500);
                s.ColumnWidths.Add(Constants.FIELD_NAME_PROCESS, 140);
                s.ColumnWidths.Add(Constants.FIELD_NAME_PRODUCT, 130);

                s.ColumnWidths.Add(Constants.FIELD_NAME_SOURCE, 50);
                s.ColumnWidths.Add(Constants.FIELD_NAME_TID, 60);
                s.ColumnWidths.Add(Constants.FIELD_NAME_TIMESTAMP, 115);
                return s;
            }
        }
    }
}
